//
// Created by sri01 on 2025/11/21.
//

#include "menu_build.h"

void (*current_operation_index)();  // 定义一个函数指针

void Menu_loop(Menu_Para* Menu_Parameter, KEY_TABLE* table)
{
    if(Menu_Parameter->func_index_last == 0)
    {
        current_operation_index = table[Menu_Parameter->func_index].current_operation;

        (*current_operation_index)();  // 执行当前操作函数
    }
    else if(Menu_Parameter->func_index != Menu_Parameter->func_index_last)
    {
        current_operation_index = table[Menu_Parameter->func_index].current_operation;

        LCD_Fill(0, 0, 240, 135, BLACK);
        (*current_operation_index)();  // 执行当前操作函数

        Menu_Parameter->func_index_last = Menu_Parameter->func_index;
    }
}
